package com.example.mybatislearn.common.mapper.converter.customer.impl;

import com.example.mybatislearn.common.lang.Enumerable;
import com.example.mybatislearn.common.lang.dto.DictionaryItemDto;
import com.example.mybatislearn.common.mapper.converter.customer.SmartTypeConverter;

public class EnumTDConverter implements SmartTypeConverter<Enumerable, DictionaryItemDto> {

    @Override
    public DictionaryItemDto convert(DictionaryItemDto existingDest, Enumerable src, Class<DictionaryItemDto> destClass, Class<Enumerable> srcClass) {
        if(src != null) {
            DictionaryItemDto dto = new DictionaryItemDto();
            dto.setCode(src.getCode());
            dto.setCodeString(src.getCodeString());
            return dto;
        }
        return null;
    }
}
